﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://www.codeplex.com/EmlenMud
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BrainTechLLC;

namespace UserInterface
{
	public partial class BaseGameThingEditor : UserControl
	{
		protected GameThingBaseClass _item;

		public void SetItem(GameThingBaseClass item)
		{
			Item = item;
		}

		protected GameThingBaseClass Item
		{
			get { return _item; }
			set { _item = value; UpdateBindings(); }
		}

		public void UpdateBindings()
		{
			if (_item != null)
			{
				gameThingBaseClassBindingSource.DataSource = _item;
				nameInfoEditor1.Item = _item.Name;
				propertyCollectionEditor1.PropList = _item.ThingProperties.Props.AllItems;
				if (_item.States != null)
				{
					stateEditor1.SetStateList(_item.States.StatesByName.AllItems);
				}
			}
		}

		public BaseGameThingEditor()
		{
			InitializeComponent();
		}
	}
}
